<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ page session="false" %>
<html>
<head>
<title>Edit Blog</title>
<link rel="stylesheet" href="<c:url value="/resources/css/backend.css" />" type="text/css">
<script type="text/javascript" src="<c:url value="/resources/javascript/jquery-1.6.1.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/ckeditor/ckeditor.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/ckeditor/adapters/jquery.js" />"></script>	

<script type="text/javascript">
  $(document).ready(function() {
	  //CKEDITOR.replace('blog_editor');
	  $( '#blog_editor' ).ckeditor();
  });
</script>

</head>
<body>
  
<div class="wrapper">
  
  <div class="header">
    <h1>iBun Admin Console</h1>
  </div>

  <div class="content">
    
    <div class="left-sider">
      <jsp:include page="../templates/adminMenu.jsp"></jsp:include>    
    </div>

    <div class="main">
    <h3>Editing Blog</h3>
    <div class="blog-creation-form">
    <form:form modelAttribute="blog" action="/admin/blogs/${blog.id}/edit" method="post">
     
      <p>  
        <form:label path="title">Title :</form:label>
		    <form:input path="title" size="35"/>
		    <form:errors path="title"/>
		  </p>  
		  <p>  
        <form:label path="categoryKey">Category :</form:label>
        <form:select path="categoryKey" items="${categories}" itemValue="id" itemLabel="name"/>
        <form:errors path="categoryKey"/>
      </p> 
      <p>  
        <form:label path="tagsString">Tags(separated by ',') :</form:label>
        <form:input path="tagsString" size="35"/>
        <form:errors path="tagsString"/>
      </p> 
		  <p>
		    <!--<form:label path="content">content</form:label>-->
		    <form:textarea id="blog_editor" path="content"></form:textarea>
		    <form:errors path="content"/>
		  </p>
		  <p>  
		    <input type="submit" value="update" />
		  </p>  

    </form:form>
    </div>
    </div>
	
	</div>
	
	<div class="footer">
  </div>
	
</div>	
</body>
</html>
